Skip to content

Hide locked users' profiles from the non-admin people index#1489

Merged
maebeale merged 1 commit into
mainfrom
maebeale/locked-user-search
May 15, 2026
Merged

Hide locked users' profiles from the non-admin people index#1489
maebeale merged 1 commit into
mainfrom
maebeale/locked-user-search

Conversation

@maebeale
Copy link
Copy Markdown
Collaborator

@maebeale maebeale commented Apr 17, 2026

What is the goal of this PR and why is this important?

  • Once non-admin users can see the People index (see HOLD UNTIL READY TO LAUNCH PROFILES: Allow authenticated users to access the people index and search #1494), they will not see profiles whose user is locked
  • Locked accounts have had access revoked; their profile should not be discoverable by facilitators on people index
  • Admins are unaffected — they continue to see all people, locked or not
  • NOTE: this code doesn't do anything rn bc facilitators don't have the People index permission yet, but, adding this logic now before we forget this additional condition

How did you approach the change?

  • Added a Person.where_user_not_locked scope: left_joins(:user) so people with no user record are still included, then keeps only rows where users.locked_at IS NULL
  • Chained .where_user_not_locked onto the non-admin branch of PersonPolicy's relation_scope, after the existing searchable.with_active_affiliations filters
  • Updated the policy spec to assert the generated SQL also includes users.locked_at IS NULL

UI Testing Checklist

  • Sign in as a regular user. Lock a user account that has a Person with an active affiliation and profile_is_searchable: true. Confirm that profile no longer appears on /people
  • Confirm a Person with no associated user but an active affiliation still appears for regular users
  • Confirm an admin viewing /people still sees locked users' profiles

Anything else to add?

@jmilljr24
Copy link
Copy Markdown
Collaborator

I wrote up this issue before seeing your PR. #1490

@maebeale maebeale force-pushed the maebeale/locked-user-search branch from 5842ef5 to 29614f7 Compare May 15, 2026 13:43
@maebeale maebeale changed the title Allow regular users to search the people index Hide locked users' profiles from the non-admin people index May 15, 2026
@maebeale maebeale changed the base branch from main to maebeale/people-index-authenticated May 15, 2026 13:44
@maebeale maebeale force-pushed the maebeale/locked-user-search branch from 29614f7 to 4a9212b Compare May 15, 2026 14:16
@maebeale maebeale force-pushed the maebeale/people-index-authenticated branch from 42ab70f to 9dbb9c9 Compare May 15, 2026 14:16
@maebeale maebeale changed the base branch from maebeale/people-index-authenticated to main May 15, 2026 14:30
Add a where_user_not_locked Person scope and chain it onto the
non-admin relation_scope so that profiles whose user account is
locked are excluded. People with no user record are still included.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/locked-user-search branch from 4a9212b to a4bb4e2 Compare May 15, 2026 14:31
@maebeale maebeale marked this pull request as ready for review May 15, 2026 14:32
@maebeale maebeale merged commit 4c2fc0c into main May 15, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/locked-user-search branch May 15, 2026 14:39
jmilljr24 pushed a commit that referenced this pull request May 20, 2026
Add a where_user_not_locked Person scope and chain it onto the
non-admin relation_scope so that profiles whose user account is
locked are excluded. People with no user record are still included.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
jmilljr24 added a commit that referenced this pull request Jun 5, 2026
* add pay gem

* pay gem migrations

* add pay_customer to person

* create allocations migration

* change payments to sti

* add refunds migration

* fix migration

* update models to use allocations

* add allocation index with cash and check payment form

* create allocation form

* us turbo stream replace

* change payment totals to allocations_sum

* clean up new payment form

* add stimulus selection for payer typer

* fix toggle of payer type search

* fix form style

* add dollars to UI

* add dollars to allocations and add payment index pagination

* titlize payment type

* display amount input with decimal

* add allocated amount to payment

* handle allocation payment transaction

* allocate payments manually

* add refunds to payments

* show refunds and allocation source

* add refund method

* add revert of allocation

* add event cost validation for allocation

* add flash errors

* show reverted reference

* fix allocated amount update

* change to amount remaining

* update flash with remaining on payment

* add stripe env

* add stripe checkout

* create payment when pay charge is paid

* add stripe refund id to refunds

* order payment lists newest first

* fix amount cents remaning for new payments

* refactor search type selector to be generic

* add join scope to remote search concern

* create payment seeds

* add seed for unallocation

* fix event create seed

* add cursor to revert button

* more refund query to controller

* add search boxes for payments

* fix search on amount remaining

* fix dropdown toggle

* add turbo frame results

* exclude remove select input typing from auto submit

* fix payment type select

* fix new payment form type select

* use turbo frame top for payment view link

* remove redudant payment name

* hard code stripe name

* comments

* fix check for nil on event allocation

* rubocop

* add turbo flash to allocations

* add allocation validation

* add search to allocations

* fix turbo frame on allocation search

* move search box columns

* add placeholder for type select

* clear search

* check for outlet

* justify end for clear filters buttons

* use model card helper

* clean up

* Fix system notifications showing Oopsie error (#1488)

* Fix system notifications showing "Oopsie!" by adopting lazy-load pattern

The notifications index rendered data inline inside a turbo frame while
also setting a src attribute to re-fetch the same data. If the redundant
request failed, the turbo:frame-missing handler replaced the content
with an error message. Aligns with the lazy-load pattern used by other
controllers (stories, people, etc.) — skeleton on initial load, data
fetched via turbo frame request.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add turbo_frame: _top to links inside notifications turbo frame

Links inside the notifications_results turbo frame were being
intercepted by Turbo, which tried to load the target page inside
the frame. The show page and polymorphic record pages don't contain
a matching turbo frame, triggering the turbo:frame-missing handler
and showing the "Oopsie!" error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Bump vulnerable gems flagged by bundler-audit (#1495)

Updates addressable, net-imap, nokogiri, rack, and rack-session to
patched versions to clear CVE advisories from the scan_ruby CI job.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* Bump actions/upload-artifact from 4 to 7 (#1485)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v4...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Hide locked users' profiles from the non-admin people index (#1489)

Add a where_user_not_locked Person scope and chain it onto the
non-admin relation_scope so that profiles whose user account is
locked are excluded. People with no user record are still included.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* create scholarship migration

* add scholarship controller and model

* add scholarship admin ui

* add scholarship crud

* remove event_reg_id from scholarship

* change allocation heading

* add discounts

* change payment payer from polymorphic to person and/or organization

* add all option to search payer type

* schema

* update nav buttons

* move amount calc to model

* clean up

* allocation results break out of turbo frame

* use results template

* clean up index action on allocation

* update reminder to work with payments

* fix simple specs

* remove feature flag

* remove auto refund

* rubocop

* handle brakeman warnings

* handle polymorphic paths for show

* add tests

* add allocation error message

* validate greated than 0 payment

* fix fully allocated regs

* add tests

* add scholarship recipient

* add stripe checkout to event reg

* handle payment for remaining cost

* add payment comments

* add amount remaining to source column

* add stripe refunds

* add refund specs

* fix spec

* spec

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: maebeale <maebeale@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants